package com.ibeeking.found.msg.rest.controller.v1;

import com.ibeeking.found.msg.rest.service.ISmsRelationService;
import com.ibeeking.found.msg.service.common.param.SmsRelationParam;
import com.ibeeking.found.msg.service.common.vo.MsgRelationVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName SmsRelationController控制器
 * @Description 消息关系配置
 * @Author ibeeking
 * @Date 2020-12-09 10:54
 **/
@RestController
@RequestMapping("/msg/smsRelation/v1")
public class SmsRelationController {

    @Resource
    private ISmsRelationService smsRelationServiceImpl;

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "通知消息关系映射修改")
    @PostMapping(value = "/modify")
    public Boolean modify(@RequestBody @Validated SmsRelationParam smsRelationParam) {
        return smsRelationServiceImpl.modify(smsRelationParam);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "通知消息关系映射查看")
    @PostMapping(value = "/view/{tenantId}/{msgTypeId}")
    public MsgRelationVO view(@PathVariable("tenantId") Integer tenantId, @PathVariable("msgTypeId") Long msgTypeId) {
        return smsRelationServiceImpl.view(tenantId, msgTypeId);
    }

    @Log(logType = OperateLogTypeEnum.DEL, describe = "通知消息关系映射删除")
    @PostMapping(value = "/del/{tenantId}/{msgTypeId}")
    public Boolean del(@PathVariable("tenantId") Integer tenantId, @PathVariable("msgTypeId") Long msgTypeId) {
        return smsRelationServiceImpl.del(tenantId, msgTypeId);
    }
}
